﻿namespace DotNetUtility.GenericDesignPattern.Test
{
    using System;
    using DotNetUtility.GenericDesignPattern;
    using NUnit.Framework;

    [TestFixture]
    public class TernaryOperationTest
    {
        [Test]
        public void TernaryOperation_With_Type_Int()
        {
            int expectedResult = 4;
            Assert.AreEqual(expectedResult, TernaryOperation<int>.Operate(() => { return true; }, 4, 2));
        }

        [Test]
        public void TernaryOperation_With_Type_Action()
        {
            Action expectedResult = TernaryOperation_Action_Test_Method_True;
            Assert.AreEqual(expectedResult,
                TernaryOperation<Action>.Operate(() => { return true; }, TernaryOperation_Action_Test_Method_True,
                TernaryOperation_Action_Test_Method_False));
        }

        [Test]
        public void TernaryOperation_Bool_With_Type_Int()
        {
            int expectedResult = 4;
            Assert.AreEqual(expectedResult,
                TernaryOperation<int>.Operate(true, 4, 5));
        }


        private void TernaryOperation_Action_Test_Method_True()
        {
            Console.WriteLine("TernaryOperation_Action_Test_Method_True");
        }

        private void TernaryOperation_Action_Test_Method_False()
        {
            Console.WriteLine("TernaryOperation_Action_Test_Method_False");
        }
    }
}
